cmake_minimum_required(VERSION 3.5)
project(ar_track_landing)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE "Debug")

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(yolo_detect_message REQUIRED)
find_package(mavros_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/AlvarMarker.msg"
  "msg/AlvarMarkers.msg"
  DEPENDENCIES std_msgs geometry_msgs 
)
include_directories(
  include)
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

add_library(ar_track 
  src/ar_track_landing.cpp
)
# target_link_libraries(ar_track ${OpenCV_LIBS} ${TENSORRT_LIBS} ${CUDA_LIBS} ${glog_LIB})
ament_target_dependencies(ar_track
  rclcpp
  sensor_msgs
  std_msgs
  geometry_msgs
  mavros_msgs
  nav_msgs
  yolo_detect_message

)

add_executable(ar_track_landing_node
  src/ar_track_landing_node.cpp)
target_link_libraries(ar_track_landing_node
ar_track)
ament_target_dependencies(ar_track_landing_node 
  rclcpp
  sensor_msgs
  std_msgs
  geometry_msgs
  mavros_msgs
  nav_msgs
  yolo_detect_message
)

install(TARGETS ar_track_landing_node
  DESTINATION lib/${PROJECT_NAME})

install(TARGETS ar_track
  ARCHIVE
  DESTINATION lib
  LIBRARY
  DESTINATION lib)
  install(DIRECTORY launch config DESTINATION share/${PROJECT_NAME})
ament_package()
